﻿using System.Linq;
using Kratos.Framework.ContentManagement.Models;

namespace Kratos.Framework.Modules.Core.Repositories
{
    public static class RepositoryExtensions
    {
        public static bool IsExistUser(this IQueryable<UserInfo> users, string userId)
        {
            return users.GetUser(userId) != null;
        }

        public static UserInfo GetUser(this IQueryable<UserInfo> users, string userId)
        {
            return users.SingleOrDefault(
                u => u.UserId == userId
                );
        }
    }
}
